const moment = require("../miniprogram_npm/moment/index.js")

function newProduct(item) {
  var ret = {};

  var time = moment(item.expireTime);

  ret.id = item.id;
  ret.name = item.name;
  ret.currentPrice = item.price;
  ret.minPrice = item.minPrice;
  ret.maxPrice = item.maxPrice;
  ret.count = item.qty;
  ret.desc = item.desc;
  ret.expriceTime = time;
  ret.expriceTimeStr = time.format("MM月DD日hh:mm");
  ret.images = item.images.split(',');

  return ret;
}

module.exports =
{
  newProduct
}